#ifndef __WINSOCKET_H_
#define __WINSOCKET_H_
#include "KLib.h"
#include "winsock2.h"
#include "IPEndpoint.h"
SK

class EXPORTEDCLASS Socket
{
protected:
	int handle;
	int af;
	int type;
	int protocol;
    String rHost;

	Socket (const Socket & other);
	Socket (int socHandle, int af, int type, int protocol, const String& rhost);

public:
	Socket (int af, int type, int protocol );
	virtual ~Socket ();

	bool connect (const String& remoteHost, u16 port);
	void bind (u16 port);
    void bind (const String& ip, u16 port);
	Socket *accept (void);
	void listen (u32 queueSize=50);
	void send (const String& str);
	int send (byte *data, u32 bufSizeBytes);
    int sendTo (byte *data, u32 bufSizeBytes, IPEndpoint& destination);  //need to create an IP endpoint class here
    void sendAll (byte *data, u32 bufSizeBytes);
	int recv (byte *buffer, u32 bufferSize);
	void close (void);

	void setTimeout (u32 timeoutMilli);
    String getRemoteHostIP (void);
};

EK
#endif